﻿#region zh-CHS 2006 - 2007 DemoSoft 团队 | en 2006 - 2007 DemoSoft Team

//     NOTES
// ---------------
//
// This file is a part of the G.O.S.E(Game Online Server Engine) for .NET.
//
//                 2006-2007 DemoSoft Team
//
//
// First Version : by H.Q.Cai - mailto:caihuanqing@hotmail.com

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation; either version 2.1 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

#region zh-CHS 包含名字空间 | en Include namespace
using System;
using System.Text;
using System.Collections.Generic;
using Demo_G.O.S.E.ServerEngine.Common;
#endregion

namespace Demo_G.O.S.E.ServerEngine.Creature.General
{
    /// <summary>
    /// 抗性Mod(可添加的,用于自定义的Mod)
    /// </summary>
    public class ResistanceMod
    {
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private Serial m_Serial = Serial.Zero;
        /// <summary>
        /// 
        /// </summary>
        private ResistanceType m_Type = ResistanceType.None;
        /// <summary>
        /// 
        /// </summary>
        private long m_Offset = 0;
        /// <summary>
        /// 
        /// </summary>
        private TimeSpan m_Duration = TimeSpan.Zero;
        /// <summary>
        /// 
        /// </summary>
        private DateTime m_Added = DateTime.Now;
        #endregion

        #region zh-CHS 构造和初始化和清理 | en Constructors and Initializers and Dispose
        /// <summary>
        /// 
        /// </summary>
        /// <param name="resistanceType"></param>
        /// <param name="iOffset"></param>
        public ResistanceMod( Serial serial, ResistanceType resistanceType, long iOffset )
        {
            m_Serial = serial;
            m_Type = resistanceType;
            m_Offset = iOffset;
            m_Added = DateTime.Now;
            m_Duration = TimeSpan.MaxValue;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="resistanceType"></param>
        /// <param name="iOffset"></param>
        public ResistanceMod( Serial serial, ResistanceType resistanceType, long iOffset, TimeSpan duration )
        {
            m_Serial = serial;
            m_Type = resistanceType;
            m_Offset = iOffset;
            m_Added = DateTime.Now;
            m_Duration = duration;
        }
        #endregion

        #region zh-CHS 共有属性 | en Public Properties
        /// <summary>
        /// 
        /// </summary>
        public Serial Serial
        {
            get { return m_Serial; }
        }
        
        /// <summary>
        /// 
        /// </summary>
        public ResistanceType Type
        {
            get { return m_Type; }
            set { m_Type = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public long Offset
        {
            get { return m_Offset; }
            set { m_Offset = value; }
        }
        #endregion

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public bool HasElapsed()
        {
            if ( m_Duration == TimeSpan.Zero )
                return false;

            return ( DateTime.Now - m_Added ) >= m_Duration;
        }
        #endregion
    }
}
#endregion

